package cloud.simple.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cloud.simple.model.User;
import cloud.simple.service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {
	private static final Logger logger = LoggerFactory.getLogger(UserController.class);
	@Autowired
	private UserService userService;

	@ResponseBody
	@RequestMapping(value = "/getUserInfo")
	public User getUserInfo() {

		return null;
	}

	@ResponseBody
	@RequestMapping(value = "/selectAllUser")
	public Object selectAllUser(@RequestParam(value = "pageStart", required = true) int pageStart,
			@RequestParam(value = "pageLimit", required = true) int pageLimit, HttpServletRequest request) {
		List<User> user = userService.selectAllUser(pageStart, pageLimit, request);
		Map<Object, Object> result = new HashMap<Object, Object>();
		result.put("user", user);
		return result;
	}
}
